<?php
define('DS', DIRECTORY_SEPARATOR);
date_default_timezone_set('PRC');

/** 应用根目录 */
defined('ROOTPATH') or define('ROOTPATH', dirname(__DIR__));
/** 核心类库 */
defined('LIBSPATH') or define('LIBSPATH', ROOTPATH . DS . 'libs');
/** 工作目录 */
defined('JOBSPATH') or define('JOBSPATH', ROOTPATH . DS . 'jobs');
/** 日志目录 */
defined('LOGSPATH') or define('LOGSPATH', ROOTPATH . DS . 'logs');
/** 配置目录 */
defined('CONFPATH') or define('CONFPATH', __DIR__);
/** 应用目录 */
defined('APPPATH') or define('APPPATH', ROOTPATH . DS . 'app');

/** 注册自动加载 */
require CONFPATH . '/autoload.php';

/** 返回配置对象 */
$config = new ImWorker\Config([
    "redisBackend" => 'localhost:6379',
    "log"          => [
        "path"       => LOGSPATH,
        "fileSize"   => 1024 * 1024 * 10,
        "timeFormat" => "Y-m-d H:i:s",
    ],
]);

$worker   = [];
$appRoute = [];

!defined('IS_WORKER') or $worker = require CONFPATH . '/worker.php';
!defined('IS_APP') or $appRoute  = require CONFPATH . '/appRoute.php';

return $config->merge($worker)->merge($appRoute);
